package com.xiashitech.agent.instrumentation.spring.refresh;

import io.opentelemetry.javaagent.shaded.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.javaagent.shaded.io.opentelemetry.api.GlobalOpenTelemetry;

public class XSSpringRefreshSingletons {
    private XSSpringRefreshSingletons() {}
    private static final String INSTRUMENTATION_NAME = "com.xiashitech.spring-refresh";
    private static final String SPAN_NAME = "xs.spring-refresh-span";
    private static final Instrumenter<Object, Void> INSTRUMENTER;
    public static Instrumenter<Object, Void> instrumenter() {
        return INSTRUMENTER;
    }

    static {
        INSTRUMENTER =
                Instrumenter.<Object, Void>builder(
                        GlobalOpenTelemetry.get(),
                        INSTRUMENTATION_NAME,
                        request -> SPAN_NAME
                ).addAttributesExtractor(new XSSpringRefreshAttributesExtractor()).buildInstrumenter();
    }
}
